﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MockupDesigner.Items;
using MockupDesigner.Editors.Controls;

namespace MockupDesigner.Editors.ValidableEditors
{
    public class DataGridEditor : ValidableEditor
    {
        private DataGridEditorControl element;
        private DataGridItem dataGrid;


        public override void SetItem(ItemBase itemToEdit)
        {
            Element = new DataGridEditorControl(this);
            base.SetItem(itemToEdit);
            dataGrid = ItemToEdit as DataGridItem;

            element = Element as DataGridEditorControl;
            element.Height = 400;
            element.Width = 800;
            element.FirstLineAsHeaders = dataGrid.FirstLineAsHeaders;
            element.Items = dataGrid.Items;
            
        }

        public override void Validate()
        {
            base.Validate();
            dataGrid.FirstLineAsHeaders = element.FirstLineAsHeaders;
            dataGrid.Items = element.Items;
        }

    }
}
